﻿/**
 * Image.cs - To hide SDL image handling
 * 
 * Part of BoulderDAM - A BoulderDash clone using C# and SDL
 * Nacho Cabanes & students of DAM IES San Vicente, 2014
 * 
 * Revisions
 * #     Date         Creator, changes
 * ----  -----------  -------------------------------------------------------
 * 0.01  02-apr-2014  Nacho Cabanes: Ability to load images
 * 
 */

using Tao.Sdl;
using System;

namespace Boulder
{
    class Image
    {
        private IntPtr internalPointer;

        public Image(string fileName)  // Constructor
        {
            Load(fileName);
        }


        public void Load(string fileName)
        {
            internalPointer = SdlImage.IMG_Load(fileName);
            if (internalPointer == IntPtr.Zero)
                Hardware.FatalError("Image not found: " + fileName);
        }


        public IntPtr GetPointer()
        {
            return internalPointer;
        }
    }
}
